"""Definition of the trafficinfo content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Itrafficinfo
from my315ok.xtinfocontent.config import PROJECTNAME

trafficinfoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.TextField(
        'text',
        storage=atapi.AnnotationStorage(),
        default_output_type = 'text/html',
        widget=atapi.RichWidget(
            label=_(u"traffic information"),
            description=_(u""),
        ),
        required=True,
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

trafficinfoSchema['title'].storage = atapi.AnnotationStorage()
trafficinfoSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(trafficinfoSchema, moveDiscussion=False)


class trafficinfo(base.ATCTContent):
    """traffic info"""
    implements(Itrafficinfo)

    meta_type = "trafficinfo"
    schema = trafficinfoSchema
    _at_rename_after_creation = True

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    text = atapi.ATFieldProperty('text')


atapi.registerType(trafficinfo, PROJECTNAME)
